interface LengthWIse {
  length: number
}

function identity<T extends LengthWIse>(arg: T): number {
  return arg.length
}

const long = identity<string>('你好')

console.log(long)

class Person<T> {
  constructor(public name: T, public sex: T) {}
}

const getadd: (x: number, y: number) => number = (x, y) => {
  return x + y
}

function getData<T>(value: T): T {
  return value
}

getData<number>(123)

// 泛型接口
interface ConfigFn {
  <T>(value: T): void
}

const getData2: ConfigFn = function <T>(value: T): void {
  console.log(value)
}

let ok1: readonly string[]
let ok2: readonly [string, number]
